home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 1.iso / HENSA / MATHS / PLPLOT / PLPLOT.ZIP / examples / C / x06c.c < prev    next >
C/C++ Source or Header  |  1994-06-30  |  2KB  |  88 lines

  1. /* $Id: x06c.c,v 1.7 1994/06/30 17:57:29 mjl Exp $
  2.  * $Log: x06c.c,v $
  3.  * Revision 1.7  1994/06/30  17:57:29  mjl
  4.  * All C example programs: made another pass to eliminate warnings when using
  5.  * gcc -Wall.  Lots of cleaning up: got rid of includes of math.h or string.h
  6.  * (now included by plplot.h), eliminated redundant casts, put in more
  7.  * uniform comments, and other minor changes.
  8.  *
  9.  * Revision 1.6  1994/03/30  07:21:49  mjl
  10.  * Changes to all C example programs: special handling for malloc re: header
  11.  * files eliminated, include of stdio.h and stdlib.h eliminated (now done
  12.  * by plplot.h), include of "plplot.h" changed to <plplot.h> to enable
  13.  * simpler builds by the general user, some cleaning up also.
  14. */
  15.  
  16. /*    x06c.c
  17.  
  18.     Font demo.
  19. */
  20.  
  21. #include <plplot.h>
  22.  
  23. /*----------------------------------------------------------------------*\
  24.  * main
  25.  *
  26.  * Displays the entire "plpoin" symbol (font) set.
  27. \*----------------------------------------------------------------------*/
  28.  
  29. int
  30. main(int argc, char *argv[])
  31. {
  32.     char text[3];
  33.     int i, j, k;
  34.     PLFLT x, y;
  35.  
  36. /* Parse and process command line arguments */
  37.  
  38.     (void) plParseInternalOpts(&argc, argv, PL_PARSE_FULL);
  39.  
  40. /* Initialize plplot */
  41.  
  42.     plinit();
  43.  
  44.     pladv(0);
  45.  
  46. /* Set up viewport and window */
  47.  
  48.     plcol(2);
  49.     plvpor(0.1, 1.0, 0.1, 0.9);
  50.     plwind(0.0, 1.0, 0.0, 1.3);
  51.  
  52. /* Draw the grid using plbox */
  53.  
  54.     plbox("bcgt", 0.1, 0, "bcgt", 0.1, 0);
  55.  
  56. /* Write the digits below the frame */
  57.  
  58.     plcol(15);
  59.     for (i = 0; i <= 9; i++) {
  60.     sprintf(text, "%d", i);
  61.     plmtex("b", 1.5, (0.1 * i + 0.05), 0.5, text);
  62.     }
  63.  
  64.     k = 0;
  65.     for (i = 0; i <= 12; i++) {
  66.  
  67. /* Write the digits to the left of the frame */
  68.  
  69.     sprintf(text, "%d", 10 * i);
  70.     plmtex("lv", 1.0, (1.0 - (2 * i + 1) / 26.0), 1.0, text);
  71.     for (j = 0; j <= 9; j++) {
  72.         x = 0.1 * j + 0.05;
  73.         y = 1.25 - 0.1 * i;
  74.  
  75. /* Display the symbols (plpoin expects that x and y are arrays so */
  76. /* pass pointers) */
  77.  
  78.         if (k < 128)
  79.         plpoin(1, &x, &y, k);
  80.         k = k + 1;
  81.     }
  82.     }
  83.  
  84.     plmtex("t", 1.5, 0.5, 0.5, "PLplot Example 6 - plpoin symbols");
  85.     plend();
  86.     exit(0);
  87. }
  88.